<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>UC-AI-002：动作识别原型</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/antd@5.12.8/dist/reset.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background-color: #f5f5f5;
            color: #333;
        }
        
        .header {
            background: #fff;
            padding: 16px 24px;
            border-bottom: 1px solid #e8e8e8;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        
        .breadcrumb {
            color: #666;
            font-size: 14px;
        }
        
        .breadcrumb a {
            color: #1890ff;
            text-decoration: none;
        }
        
        .main-content {
            padding: 24px;
            max-width: 1400px;
            margin: 0 auto;
        }
        
        .content-area {
            display: grid;
            grid-template-columns: 1fr 400px;
            gap: 24px;
        }
        
        .main-panel {
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            overflow: hidden;
        }
        
        .panel-header {
            background: #fafafa;
            padding: 16px 20px;
            border-bottom: 1px solid #e8e8e8;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .panel-title {
            font-size: 16px;
            font-weight: 600;
            color: #333;
        }
        
        .status-indicator {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #52c41a;
        }
        
        .status-text {
            font-size: 12px;
            color: #666;
        }
        
        .video-section {
            position: relative;
            background: #000;
            height: 500px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .video-placeholder {
            color: #fff;
            text-align: center;
        }
        
        .video-placeholder-icon {
            font-size: 64px;
            margin-bottom: 16px;
            opacity: 0.6;
        }
        
        .video-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.3);
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            transition: opacity 0.3s;
        }
        
        .video-section:hover .video-overlay {
            opacity: 1;
        }
        
        .video-controls {
            display: flex;
            gap: 12px;
        }
        
        .control-btn {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: rgba(255,255,255,0.9);
            border: none;
            color: #333;
            font-size: 20px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s;
        }
        
        .control-btn:hover {
            background: #fff;
            transform: scale(1.1);
        }
        
        .recognition-panel {
            padding: 20px;
        }
        
        .recognition-status {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }
        
        .status-info {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .status-badge {
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 500;
        }
        
        .status-badge.recognizing {
            background: #fff7e6;
            color: #faad14;
            border: 1px solid #ffd591;
        }
        
        .status-badge.completed {
            background: #f6ffed;
            color: #52c41a;
            border: 1px solid #b7eb8f;
        }
        
        .status-badge.error {
            background: #fff2f0;
            color: #ff4d4f;
            border: 1px solid #ffccc7;
        }
        
        .confidence-bar {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .confidence-label {
            font-size: 12px;
            color: #666;
        }
        
        .confidence-progress {
            width: 100px;
            height: 6px;
            background: #f0f0f0;
            border-radius: 3px;
            overflow: hidden;
        }
        
        .confidence-fill {
            height: 100%;
            background: #52c41a;
            border-radius: 3px;
            transition: width 0.3s;
        }
        
        .confidence-value {
            font-size: 11px;
            color: #666;
        }
        
        .recognition-results {
            margin-bottom: 20px;
        }
        
        .result-item {
            padding: 12px;
            border: 1px solid #e8e8e8;
            border-radius: 6px;
            margin-bottom: 8px;
            transition: all 0.3s;
        }
        
        .result-item:hover {
            border-color: #1890ff;
            background: #f0f8ff;
        }
        
        .result-item.recognized {
            border-color: #52c41a;
            background: #f6ffed;
        }
        
        .result-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
        }
        
        .result-name {
            font-size: 14px;
            font-weight: 500;
            color: #333;
        }
        
        .result-confidence {
            font-size: 12px;
            color: #666;
        }
        
        .result-description {
            font-size: 12px;
            color: #666;
            line-height: 1.4;
        }
        
        .action-buttons {
            display: flex;
            gap: 8px;
        }
        
        .btn {
            padding: 6px 12px;
            border: 1px solid;
            border-radius: 4px;
            font-size: 12px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 4px;
            transition: all 0.3s;
        }
        
        .btn-primary {
            background: #1890ff;
            border-color: #1890ff;
            color: #fff;
        }
        
        .btn-primary:hover {
            background: #40a9ff;
            border-color: #40a9ff;
        }
        
        .btn-success {
            background: #52c41a;
            border-color: #52c41a;
            color: #fff;
        }
        
        .btn-success:hover {
            background: #73d13d;
            border-color: #73d13d;
        }
        
        .btn-default {
            background: #fff;
            border-color: #d9d9d9;
            color: #333;
        }
        
        .btn-default:hover {
            border-color: #1890ff;
            color: #1890ff;
        }
        
        .sidebar {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }
        
        .sidebar-panel {
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            overflow: hidden;
        }
        
        .sidebar-header {
            background: #fafafa;
            padding: 16px 20px;
            border-bottom: 1px solid #e8e8e8;
        }
        
        .sidebar-title {
            font-size: 16px;
            font-weight: 600;
            color: #333;
        }
        
        .sidebar-content {
            padding: 20px;
        }
        
        .action-list {
            list-style: none;
        }
        
        .action-item {
            padding: 12px;
            border: 1px solid #f0f0f0;
            border-radius: 6px;
            margin-bottom: 8px;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .action-item:hover {
            border-color: #1890ff;
            background: #f0f8ff;
        }
        
        .action-item.selected {
            border-color: #1890ff;
            background: #e6f7ff;
        }
        
        .action-name {
            font-size: 13px;
            font-weight: 500;
            color: #333;
            margin-bottom: 4px;
        }
        
        .action-desc {
            font-size: 11px;
            color: #666;
            line-height: 1.4;
        }
        
        .recognition-settings {
            margin-bottom: 20px;
        }
        
        .setting-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 0;
            border-bottom: 1px solid #f0f0f0;
        }
        
        .setting-item:last-child {
            border-bottom: none;
        }
        
        .setting-label {
            font-size: 13px;
            color: #333;
        }
        
        .setting-control {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .setting-control input[type="checkbox"] {
            margin: 0;
        }
        
        .setting-control select {
            padding: 4px 8px;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
            font-size: 11px;
        }
        
        .recognition-stats {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }
        
        .stat-item {
            text-align: center;
            padding: 12px;
            background: #f8f9fa;
            border-radius: 6px;
        }
        
        .stat-value {
            font-size: 18px;
            font-weight: 600;
            color: #1890ff;
            margin-bottom: 4px;
        }
        
        .stat-label {
            font-size: 11px;
            color: #666;
        }
        
        .modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.5);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }
        
        .modal-content {
            background: #fff;
            border-radius: 8px;
            padding: 24px;
            max-width: 600px;
            width: 90%;
        }
        
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }
        
        .modal-title {
            font-size: 18px;
            font-weight: 600;
            color: #333;
        }
        
        .modal-close {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #999;
        }
        
        .modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 12px;
            margin-top: 20px;
        }
        
        @media (max-width: 768px) {
            .content-area {
                grid-template-columns: 1fr;
            }
            
            .sidebar {
                order: -1;
            }
        }
    </style>
</head>
<body>
    <!-- 页面头部 -->
    <div class="header">
        <div class="breadcrumb">
            <a href="#">首页</a> > <a href="#">AI识别</a> > 动作识别
        </div>
    </div>

    <!-- 主要内容区域 -->
    <div class="main-content">
        <div class="content-area">
            <!-- 主面板 -->
            <div class="main-panel">
                <div class="panel-header">
                    <div class="panel-title">动作识别分析</div>
                    <div class="status-indicator">
                        <div class="status-dot"></div>
                        <span class="status-text">识别中</span>
                    </div>
                </div>
                
                <!-- 视频区域 -->
                <div class="video-section">
                    <div class="video-placeholder">
                        <div class="video-placeholder-icon">📹</div>
                        <div>实时视频流</div>
                    </div>
                    <div class="video-overlay">
                        <div class="video-controls">
                            <button class="control-btn" onclick="startRecognition()">▶️</button>
                            <button class="control-btn" onclick="pauseRecognition()">⏸️</button>
                            <button class="control-btn" onclick="stopRecognition()">⏹️</button>
                            <button class="control-btn" onclick="captureFrame()">📷</button>
                        </div>
                    </div>
                </div>
                
                <!-- 识别面板 -->
                <div class="recognition-panel">
                    <div class="recognition-status">
                        <div class="status-info">
                            <div class="status-badge recognizing">识别中</div>
                            <div class="confidence-bar">
                                <span class="confidence-label">置信度:</span>
                                <div class="confidence-progress">
                                    <div class="confidence-fill" style="width: 85%;"></div>
                                </div>
                                <span class="confidence-value">85%</span>
                            </div>
                        </div>
                        <div class="action-buttons">
                            <button class="btn btn-primary" onclick="startRecognition()">开始识别</button>
                            <button class="btn btn-default" onclick="pauseRecognition()">暂停识别</button>
                            <button class="btn btn-success" onclick="saveResults()">保存结果</button>
                        </div>
                    </div>
                    
                    <div class="recognition-results">
                        <div class="result-item recognized">
                            <div class="result-header">
                                <div class="result-name">工具准备动作</div>
                                <div class="result-confidence">置信度: 92%</div>
                            </div>
                            <div class="result-description">正确佩戴安全帽，检查工具状态，准备开始操作</div>
                        </div>
                        
                        <div class="result-item recognized">
                            <div class="result-header">
                                <div class="result-name">安全检查动作</div>
                                <div class="result-confidence">置信度: 88%</div>
                            </div>
                            <div class="result-description">检查工作环境，确认安全措施到位</div>
                        </div>
                        
                        <div class="result-item">
                            <div class="result-header">
                                <div class="result-name">操作执行动作</div>
                                <div class="result-confidence">置信度: 75%</div>
                            </div>
                            <div class="result-description">按照标准流程执行操作任务</div>
                        </div>
                        
                        <div class="result-item">
                            <div class="result-header">
                                <div class="result-name">完成检查动作</div>
                                <div class="result-confidence">置信度: 65%</div>
                            </div>
                            <div class="result-description">操作完成后进行最终检查</div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 侧边栏 -->
            <div class="sidebar">
                <!-- 动作库 -->
                <div class="sidebar-panel">
                    <div class="sidebar-header">
                        <div class="sidebar-title">动作库</div>
                    </div>
                    <div class="sidebar-content">
                        <ul class="action-list">
                            <li class="action-item selected" onclick="selectAction(this)">
                                <div class="action-name">工具准备</div>
                                <div class="action-desc">佩戴安全防护用品，准备操作工具</div>
                            </li>
                            <li class="action-item" onclick="selectAction(this)">
                                <div class="action-name">安全检查</div>
                                <div class="action-desc">检查工作环境和安全措施</div>
                            </li>
                            <li class="action-item" onclick="selectAction(this)">
                                <div class="action-name">操作执行</div>
                                <div class="action-desc">按照标准流程执行操作</div>
                            </li>
                            <li class="action-item" onclick="selectAction(this)">
                                <div class="action-name">完成检查</div>
                                <div class="action-desc">操作完成后的检查工作</div>
                            </li>
                            <li class="action-item" onclick="selectAction(this)">
                                <div class="action-name">工具归位</div>
                                <div class="action-desc">将工具放回指定位置</div>
                            </li>
                        </ul>
                    </div>
                </div>

                <!-- 识别设置 -->
                <div class="sidebar-panel">
                    <div class="sidebar-header">
                        <div class="sidebar-title">识别设置</div>
                    </div>
                    <div class="sidebar-content">
                        <div class="recognition-settings">
                            <div class="setting-item">
                                <span class="setting-label">实时识别</span>
                                <div class="setting-control">
                                    <input type="checkbox" checked>
                                </div>
                            </div>
                            <div class="setting-item">
                                <span class="setting-label">置信度阈值</span>
                                <div class="setting-control">
                                    <select>
                                        <option value="0.8" selected>80%</option>
                                        <option value="0.7">70%</option>
                                        <option value="0.9">90%</option>
                                    </select>
                                </div>
                            </div>
                            <div class="setting-item">
                                <span class="setting-label">识别精度</span>
                                <div class="setting-control">
                                    <select>
                                        <option value="high" selected>高</option>
                                        <option value="medium">中</option>
                                        <option value="low">低</option>
                                    </select>
                                </div>
                            </div>
                            <div class="setting-item">
                                <span class="setting-label">保存视频</span>
                                <div class="setting-control">
                                    <input type="checkbox">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 识别统计 -->
                <div class="sidebar-panel">
                    <div class="sidebar-header">
                        <div class="sidebar-title">识别统计</div>
                    </div>
                    <div class="sidebar-content">
                        <div class="recognition-stats">
                            <div class="stat-item">
                                <div class="stat-value">15</div>
                                <div class="stat-label">识别动作数</div>
                            </div>
                            <div class="stat-item">
                                <div class="stat-value">92%</div>
                                <div class="stat-label">平均置信度</div>
                            </div>
                            <div class="stat-item">
                                <div class="stat-value">3</div>
                                <div class="stat-label">错误动作数</div>
                            </div>
                            <div class="stat-item">
                                <div class="stat-value">12</div>
                                <div class="stat-label">正确动作数</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 结果详情弹窗 -->
    <div class="modal" id="resultModal">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">动作识别详情</h3>
                <button class="modal-close" onclick="closeModal()">&times;</button>
            </div>
            <div class="modal-body">
                <div style="margin-bottom: 16px;">
                    <h4 style="margin-bottom: 8px; color: #333;">动作信息</h4>
                    <div style="background: #f8f9fa; padding: 12px; border-radius: 6px; font-size: 14px; line-height: 1.6;">
                        <p style="margin-bottom: 8px;"><strong>动作名称:</strong> 工具准备动作</p>
                        <p style="margin-bottom: 8px;"><strong>识别时间:</strong> 2024-05-15 14:30:15</p>
                        <p style="margin-bottom: 8px;"><strong>持续时间:</strong> 2分30秒</p>
                        <p style="margin-bottom: 8px;"><strong>置信度:</strong> 92%</p>
                        <p><strong>状态:</strong> 识别成功</p>
                    </div>
                </div>
                
                <div style="margin-bottom: 16px;">
                    <h4 style="margin-bottom: 8px; color: #333;">关键帧</h4>
                    <div style="background: #f8f9fa; padding: 12px; border-radius: 6px; text-align: center; color: #666;">
                        📷 关键帧截图区域
                    </div>
                </div>
                
                <div>
                    <h4 style="margin-bottom: 8px; color: #333;">动作分析</h4>
                    <div style="background: #f8f9fa; padding: 12px; border-radius: 6px; font-size: 14px; line-height: 1.6;">
                        <p style="margin-bottom: 8px;">• 正确佩戴安全帽 ✓</p>
                        <p style="margin-bottom: 8px;">• 检查工具状态 ✓</p>
                        <p style="margin-bottom: 8px;">• 确认工作环境安全 ✓</p>
                        <p>• 准备开始操作 ✓</p>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" onclick="closeModal()">关闭</button>
                <button class="btn btn-primary" onclick="exportResult()">导出结果</button>
            </div>
        </div>
    </div>

    <script>
        // 全局变量
        let isRecognizing = false;
        let isPaused = false;

        // 识别控制
        function startRecognition() {
            isRecognizing = true;
            isPaused = false;
            
            const statusDot = document.querySelector('.status-dot');
            const statusText = document.querySelector('.status-text');
            
            statusDot.style.background = '#faad14';
            statusText.textContent = '识别中';
            
            console.log('开始动作识别');
        }

        function pauseRecognition() {
            isPaused = !isPaused;
            
            const statusText = document.querySelector('.status-text');
            
            if (isPaused) {
                statusText.textContent = '已暂停';
            } else {
                statusText.textContent = '识别中';
            }
            
            console.log('暂停/继续识别');
        }

        function stopRecognition() {
            isRecognizing = false;
            isPaused = false;
            
            const statusDot = document.querySelector('.status-dot');
            const statusText = document.querySelector('.status-text');
            
            statusDot.style.background = '#52c41a';
            statusText.textContent = '识别完成';
            
            console.log('停止动作识别');
        }

        function captureFrame() {
            console.log('捕获关键帧');
        }

        function saveResults() {
            console.log('保存识别结果');
        }

        // 动作选择
        function selectAction(element) {
            document.querySelectorAll('.action-item').forEach(item => {
                item.classList.remove('selected');
            });
            element.classList.add('selected');
            
            const actionName = element.querySelector('.action-name').textContent;
            console.log('选择动作:', actionName);
        }

        // 结果操作
        function viewResultDetails(element) {
            document.getElementById('resultModal').style.display = 'flex';
        }

        function exportResult() {
            closeModal();
            console.log('导出识别结果');
        }

        // 弹窗控制
        function closeModal() {
            document.getElementById('resultModal').style.display = 'none';
        }

        // 点击弹窗外部关闭
        document.getElementById('resultModal').addEventListener('click', (e) => {
            if (e.target.id === 'resultModal') {
                closeModal();
            }
        });

        // 结果项点击事件
        document.querySelectorAll('.result-item').forEach(item => {
            item.addEventListener('click', () => {
                viewResultDetails(item);
            });
        });

        // 初始化
        document.addEventListener('DOMContentLoaded', () => {
            console.log('动作识别页面初始化');
        });
    </script>
</body>
</html>

